package com.pinda.controller;

import com.github.pagehelper.PageInfo;
import com.pinda.auth.entity.PdAuthRole;
import com.pinda.auth.search.PdAuthRoleSearch;
import com.pinda.authorization.entity.Role;
import com.pinda.commonutils.Page;
import com.pinda.commonutils.Result;
import com.pinda.commonutils.StatusCode;
import com.pinda.service.RoleService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 角色 前端控制器
 * </p>
 *
 * @author 黄杰
 * @since 2023-06-13
 */
@RestController
@RequestMapping("/role")
public class RoleController {
    @Resource
    private RoleService roleService;

    /**
     * TODO 根据用户编号查询用户拥有的角色
     * @param userId
     * @return Result<List<Role>>
     */
    @RequestMapping("findUserIdRole/{id}")
    public Result<List<Role>> findUserIdRole(@PathVariable("id") String userId){
        return new Result<List<Role>>(true, StatusCode.OK, "查询成功",this.roleService.findUserIdRoleService(userId));
    }
}
